<template>
  <div class="pie-echarts">
    <base-echarts :options="option" />
  </div>
</template>

<script setup lang="ts">
import { computed } from 'vue'
import baseEcharts from './base-echarts.vue'
import type { EChartsCoreOption } from 'echarts'
import type { commonDataType } from '../types'
const props = defineProps<{
  pieData: commonDataType[]
}>()
const option = computed<EChartsCoreOption>(() => {
  return {
    tooltip: {
      trigger: 'item'
    },
    legend: {
      orient: 'horizontal',
      left: 'center'
    },
    series: [
      {
        name: '访问来源',
        type: 'pie',
        radius: '50%',
        bottom: '-15%',
        data: props.pieData,
        emphasis: {
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: 'rgba(0, 0, 0, 0.5)'
          }
        }
      }
    ]
  }
})
</script>

<style lang="less" scoped>
.pie-echarts {
  h2 {
    color: red;
  }
}
</style>
